package com.coderknock.jedis.push;

import redis.clients.jedis.JedisPubSub;
/**
 * @author  mouliu
 * 消息发布订阅 监听
 * **/
public class PushSubListener extends JedisPubSub {
    //取得订阅后消息的处理
    @Override
    public void onMessage(String channel, String message) {
        System.out.print("onMessage:取得订阅后消息的处理  ");
        System.out.println(channel + "=" + message);
    }

    //取得按表达式的方式订阅的消息后的处理
    @Override
    public void onPMessage(String pattern, String channel, String message) {
        System.out.print("onPMessage:取得按表达式的方式订阅的消息后的处理    ");
        System.out.println(pattern + "=" + channel + "=" + message);
    }

    //初始化按表达式的方式订阅时候的处理
    @Override
    public void onPSubscribe(String pattern, int subscribedChannels) {
        System.out.print("onPSubscribe:初始化按表达式的方式订阅时候的处理   ");
        System.out.println(pattern + "=" + subscribedChannels);
    }

    //取消化按表达式的方式订阅时候的处理
    @Override
    public void onPUnsubscribe(String pattern, int subscribedChannels) {
        System.out.print("onPUnsubscribe:取消化按表达式的方式订阅时候的处理   ");
        System.out.println(pattern + "=" + subscribedChannels);
    }

    //初始化订阅时候的处理
    @Override
    public void onSubscribe(String channel, int subscribedChannels) {
        System.out.print("onSubscribe:初始化订阅时候的处理   ");
        System.out.println(channel + "=" + subscribedChannels);
    }

    //取消订阅时候的处理
    @Override
    public void onUnsubscribe(String channel, int subscribedChannels) {
        System.out.print("onUnsubscribe:取消订阅时候的处理   ");
        System.out.println(channel + "=" + subscribedChannels);
    }
}
